home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 26 / AMIGAplus Sonderheft 26 (2000)(Falke)(DE)(Track 1 of 2)[!].iso / Tools / GFX-Viewer / Animviewer / mpegvideo_datatype / mpeggray.c < prev    next >
C/C++ Source or Header  |  1999-03-29  |  2KB  |  66 lines

  1.  
  2. /*
  3. **
  4. **  $VER: mpeggray.c 1.4 (9.11.96)
  5. **  mpegvideo.datatype 1.0
  6. **
  7. **  grayscale dithering
  8. **
  9. **  Written 1996 by Roland 'Gizzy' Mainz
  10. **
  11. */
  12.  
  13. /* project includes */
  14. #include "mpegmyassert.h"
  15. #include "mpegvideo.h"
  16. #include "mpegproto.h"
  17.  
  18.  
  19. /*
  20.  *--------------------------------------------------------------
  21.  *
  22.  * GrayDitherImage --
  23.  *
  24.  *    Dithers image into 128 gray scales. Simply maps luminance
  25.  *      value into 1 of 128 gray scale colors (divide by two, essentially).
  26.  *
  27.  * Results:
  28.  *    None.
  29.  *
  30.  * Side effects:
  31.  *    None.
  32.  *
  33.  *--------------------------------------------------------------
  34.  */
  35.  
  36.  
  37. void GrayDitherImage( struct MPEGVideoInstData *mvid, UBYTE *lum, UBYTE *cr, UBYTE *cb, UBYTE *out, UWORD h, UWORD w )
  38. {
  39.     ULONG i,
  40.           max = (w * h) / 16;
  41.  
  42.     for( i = 0UL ; i < max ; i++ )
  43.     {
  44.       out[  0 ] = mappixel[ lum[  0 ] ];
  45.       out[  1 ] = mappixel[ lum[  1 ] ];
  46.       out[  2 ] = mappixel[ lum[  2 ] ];
  47.       out[  3 ] = mappixel[ lum[  3 ] ];
  48.       out[  4 ] = mappixel[ lum[  4 ] ];
  49.       out[  5 ] = mappixel[ lum[  5 ] ];
  50.       out[  6 ] = mappixel[ lum[  6 ] ];
  51.       out[  7 ] = mappixel[ lum[  7 ] ];
  52.       out[  8 ] = mappixel[ lum[  8 ] ];
  53.       out[  9 ] = mappixel[ lum[  9 ] ];
  54.       out[ 10 ] = mappixel[ lum[ 10 ] ];
  55.       out[ 11 ] = mappixel[ lum[ 11 ] ];
  56.       out[ 12 ] = mappixel[ lum[ 12 ] ];
  57.       out[ 13 ] = mappixel[ lum[ 13 ] ];
  58.       out[ 14 ] = mappixel[ lum[ 14 ] ];
  59.       out[ 15 ] = mappixel[ lum[ 15 ] ];
  60.  
  61.       out += 16;
  62.       lum += 16;
  63.     }
  64. }
  65.  
  66.